package com.heima.commnet.controller;

import com.alibaba.fastjson.JSON;
import com.heima.commnet.service.CommentService;
import com.heima.model.article.dtos.ArticleCommentDto;
import com.heima.model.common.dtos.ResponseResult;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@Slf4j
@RestController
@RequestMapping("/api/v1/comment")
public class CommentController {
    @Autowired
    private CommentService commentService;
    @PostMapping("/load")
    public ResponseResult load(@RequestBody ArticleCommentDto dto) {
        return commentService.load(dto);
    }

    @PostMapping("/save")
    public ResponseResult save(@RequestBody ArticleCommentDto dto) {
        return commentService.save(dto);
    }

    @PostMapping("/like")
    public ResponseResult like(@RequestBody ArticleCommentDto dto) {
        return commentService.like(dto);
    }
}
